<?php

class App_Model_Buddy extends Ext_Db_Table 
{
    public function getMyBuddyCount($userId)
    {
        $db = $this->getAdapter();
        $select = $db->select();
        $select
            ->from($this->_dbprefix."buddy", array(
               Zend_Paginator_Adapter_DbSelect::ROW_COUNT_COLUMN => 'COUNT(*)'
            ))
            ->where('userId = :userId')
            ;
        $params = array('userId' => $userId);
        $select->bind($params);
        
        return $select;
    }
    
    public function getMyBuddyList($userId)
    {
        $db = $this->getAdapter();
        $select = $db->select();
        $select
            ->from($this->_dbprefix."buddy", "buddyUserId")
            ->order('id DESC')
            ->where('userId = :userId')
            ;
        $params = array('userId' => $userId);
        $select->bind($params);
        
        return $select;
    }
    
}